<template>
    <div class="school">
        <h2>学校名称:{{ name }}</h2>
        <h2>学校名称:{{ address }}</h2>
        <button @click="sendSchoolName">把学校给父组件</button>
    </div>
</template>

<script>

export default {
    name: "School",
    props: ["getSchoolName"],
    data() {
        return {
            name:"冯镠霖School",
            address: "中国School"
        }
    },
    methods: {
        sendSchoolName() {
            console.log(this.getSchoolName)
            this.getSchoolName(this.name)
        }
    }
}
</script>

<style scoped>
.school {
    background-color: #e59625;
}
</style>